export function formatDate(date, separator = '-') {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  return `${year}${separator}${month}${separator}${day}`
}
export function formatTimestampToDate(timestamp, separator) {
  return formatDate(new Date(timestamp), separator)
}

export function formatDateTime(date, separator = '-') {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()
  return `${year}${separator}${String(month).padStart(2, '0')}${separator}${String(day).padStart(2, '0')} ${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}:${String(second).padStart(2, '0')}`
}

export function formatTimestampToDateTime(timestamp, separator) {
  return formatDateTime(new Date(timestamp), separator)
}
